package GUI;

import javax.swing.JFrame;

import lejos.pc.comm.NXTInfo;
import Controllers.Controller;

/**
 * Custom runnable object for instantiating a new JFrame in a
 * parameterized started thread.
 * @author Danny, Didzis, Liviu.
 *
 */
public class ConnectionThread implements Runnable {

	private JFrame window;
	private NXTInfo device;
	private double x;
	private double y;
	private Controller control;

	/**
	 * Constructor taking in parameters to pass on to a new thread.
	 * 
	 * @param deviceInfo - NXTInfo object.
	 * @param X - double value representing an X coordinate.
	 * @param Y - double value representing an Y coordinate.
	 * @param controller - class handling events in a MVC architecture.
	 */
	public ConnectionThread(NXTInfo deviceInfo, double X, double Y,
			Controller controller) {
		device = deviceInfo;
		x = X;
		y = Y;
		control = controller;
	}

	@Override
	public void run() {
		System.out
				.println("ConnectionThread trying to spawn a new window (26)");
		window = new ConnectionFrame(device, x, y, control);
		System.out.println("ConnectionThread spawned a new window (28)");
	}

}
